<?php
	
	echo $accessibility->whereIAm($pageTitle,array(array('title'=>'Notícias','link'=>'/noticias'),array('title'=>'Visualizar notícia')));
	echo $this->renderElement('message');
	echo "<h2 id='contentTitle'>".$pageTitle."</h2>";
	echo "<div id='view'>";

	if(isset($noticia))
	{	
		echo "<p><label>Título: </label><span>".$noticia['Noticia']['title']."</span></p>";
		echo "<p><label>Autor: </label><span>".$noticia['User']['name']."</span></p>";
	
		
		echo "<p><label>Data: </label><span>".date("d/m/Y",strtotime($noticia['Noticia']['publishedon']))."</span></p>";
		echo "<span>".$noticia['Noticia']['text']."</span>";
	
		echo "<br />";
		echo "<br />";
	}
	else
	{
		echo 'Erro! Notícia excluída ou não publicada.';
	}

	/* Botoes - Inicio */
	$entity = 'noticias';
	$model = 'Noticia';
	$label = 'notícia';
	$label_plural = 'notícias';
	
	echo "<div class='buttonBox'>";
	echo "<div class='buttonMinibox'>";
	$listButton = "<span class=\"buttonList\">Listar ".$label_plural."</span>";
	echo html_entity_decode($html->link($listButton, '/'.$entity.'/',array('class'=>'button')));
	echo "</div>";

	echo "<div class='buttonMinibox'>";
	if ($othAuth->hasPermission($entity.'/edit/')) {
		$editButton = "<span class=\"buttonEdit\">Editar ".$label."</span>";
		echo html_entity_decode($html->link($editButton, '/'.$entity.'/edit/'.$noticia[$model]['id'],array('class'=>'button')));
	}
	echo "</div>";

	echo "<div class='buttonMinibox'>";
	if ($othAuth->hasPermission($entity.'/delete/')) {
		$deleteButton = "<span class=\"buttonDelete\">Apagar ".$label."</span>";
		echo html_entity_decode($html->link($deleteButton,'/'.$entity.'/delete/'.$noticia[$model]['id'], array('class'=>'button'), 'Confirma a exclusão deste item?'));
	}

	echo "</div>";
	echo "</div>";
	/* Botoes - Fim */
	
	echo "</div>";
